package com.example.demo1.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.example.demo1.R;

public class ActivityB extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.act_b);

        //获得Intent对象
        Intent intent = getIntent();

        //根据key值获取从上个界面传递过来的value
        String strValue = intent.getStringExtra("key");

        TextView textView = findViewById(R.id.text_content);

        textView.setText(strValue);
    }
}
